package com.dzl.goods;

import com.dzl.admin.WelfareBaseInfoController;
import com.dzl.goods.pojo.vo.WelfareGoodsClassifyVo;
import com.dzl.goods.service.WelfareGoodsClassifyService;
import com.dzl.util.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 商品分类表(WelfareGoodsClassify)表控制层
 * @author ChenLong
 * @since 2021-05-18 10:42:58
 */
@Slf4j
@RestController
@RequestMapping("welfareGoodsClassify")
public class WelfareGoodsClassifyController extends WelfareBaseInfoController {

    @Autowired
    private WelfareGoodsClassifyService welfareGoodsClassifyService;

    /**
     * 获取分类列表
     * @return java.util.List
     * @author ChenLong
     * @since 2021-05-18 16:35:27
     **/
    @GetMapping(value = "getGoodsClassify")
    public JsonResult<List<WelfareGoodsClassifyVo>> getGoodsClassify() {
        log.info("getGoodsClassify in");
        //判断当前企业是自行配置还是同步福利兔商品分类
        Integer enterpriseId=getDataSourcesEnterpriseId();
        return JsonResult.success(welfareGoodsClassifyService.getGoodsClassifyWithOutEmptySub(enterpriseId));
    }
}
